//
//  MineDiaryViewController.m
//  baodongPro
//
//  Created by feng on 16/2/29.
//  Copyright © 2016年 proper. All rights reserved.
//

#import "MineDiaryViewController.h"
#import "FBDTopSelectView.h"


#import "ReadViewController.h" //读
#import "SpeakViewController.h"//说
#import "WriteViewController.h"//写
#import "SearchViewController.h"//搜
#import "RemindViewController.h"//提
#import "SafeViewController.h"  //秘
@interface MineDiaryViewController ()

@end

@implementation MineDiaryViewController
{
    UIView*  _attentionView;
    FBDTopSelectView* attentionListScrollView;
    NSMutableArray* _subViewColtrollersArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    _subViewColtrollersArray=[NSMutableArray array];
    NSArray <NSString*> *subViewControllerNames=@[@"ReadViewController",@"SpeakViewController",
                                      @"WriteViewController",@"SearchViewController",
                                      @"RemindViewController",@"SafeViewController"];
    
    

    
    NSMutableArray* buttonArray=[NSMutableArray arrayWithObjects:@"读",@"说",@"写",@"提",@"搜",@"秘", nil];
    attentionListScrollView=[[FBDTopSelectView alloc] initWithFrame:CGRectMake(0,3, ScreenW, 50) withButtonUrls:buttonArray selectButtonItemBlock:^(NSInteger indexItem) {
        NSLog(@"点击了 第 %ld 个 Item ",indexItem);
        BaseViewController* indexBaseViewController= [_subViewColtrollersArray  objectAtIndex:indexItem];
        if (![self.view .subviews containsObject:indexBaseViewController.view])
        {
            [self.containedView addSubview:indexBaseViewController.containedView];
        }
        
        
    }];
    
    [self.containedView addSubview:attentionListScrollView];
   [subViewControllerNames enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop){
       BaseViewController* everyBaseViewController =[[NSClassFromString(obj)  alloc] init];
       [_subViewColtrollersArray addObject:everyBaseViewController];
       [self addChildViewController:everyBaseViewController];
       
   }];
    
    
    
    
    
    
    
    
    
    // 默认的选择项目
    [attentionListScrollView setUpButtonClickedIndex:0];
    
    
    
    

    
    
    
    
}

/**
 *  comment TitleLabel
 */
-(UILabel*)createCommentTitleViewWithString:(NSString*)comeStr
{
    UILabel* commentTitleView=[self.view fbd_quickCreateUILabelWithFrame:CGRectMake(15,18, ScreenW, 18)];
    commentTitleView.backgroundColor=[UIColor whiteColor];
    commentTitleView.text=comeStr;
    
    return commentTitleView;
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
